<?php

/**
 * Description of MantUsuario
 *
 * @author EaDeveloper
 */
class MantCampos extends FastMaintenance {

    public function __construct() {
        $this->table = "cllg_tablefield";
        $this->gridCols = array("ID","NAME", "CAPTION", "TYPE", "CONTROL_TYPE", "TABLE_NAME");
        $this->fieldsConfig = array("ID"=>"ID","NAME" => "CAMPO", "CAPTION" => "ETIQUETA", "TYPE" => "TIPO"
            , "CONTROL_TYPE" => array("CONTROL", array("textbox" => "Normal", "select" => "Listado", "textarea" => "Grande")), "REQUIRED" => "REQUERIDO",
            "TABLE_NAME" => array("TABLA", array("cllg_student" => "Estudiantes", "cllg_teacher" => "Catedraticos", "cllg_parent" => "Padres"))
            , "FK_TAB" => "TAB", "ORD" => "ORDEN",
            "STATUS" => array("ESTADO", array("1" => "Activo", "0" => "Inactivo")), "WIDGET" => "ARTEFACTO", "FK_CATALOG" => "CATALGO");
        $this->autoPK = false;
        $this->pkFields = array("ID");
        $this->tittle = "Mantenimiento de Campos";
        $this->windowTittle = $this->tittle;
        $this->instanceName = "MantCampos";
        $this->db = DbManager::getMe();
    }

    public function main() {
        $r = $this->db->queryToArray("select * from cllg_util_catalog ");
        $v = array();
        foreach ($r as $f) {
            $v[$f["ID"]] = $f["NOMBRE"];
        }
        $this->fieldsConfig["FK_CATALOG"] = array("CATALOGO", $v);

        $r = $this->db->queryToArray("select * from cllg_util_widget");
        $v = array();
        foreach ($r as $f) {
            $v[$f["ID"]] = $f["DESC"];
        }
        $this->fieldsConfig["WIDGET"] = array("ARTEFACTO", $v);
        parent::main();
    }

}

?>
